home *** CD-ROM | disk | FTP | other *** search
- PAGE 96,132
- ;**********************************************************************
- ; DELAYC.ASM Clipper UDF to delay n timer ticks
- ; Author..: Sal Ricciardi
- ;
- ; Use this file for program delays that are the same irregardless
- ; of CPU type and speed. Relies on the BIOS timer tick count.
- ; Maximum delay is 65535 ticks (about 1 hr). Does not validate
- ; passed parameters.
- ;
- ; Usage:
- ;
- ; DELAY(10*18.2) && for 10 seconds
- ;
- ; Create .OBJ with: TASM delayc (Borland Turbo Assembler 2.5)
- ;
- ; To link into your Clipper 5 app:
- ; RTLINK FILE yourapp.obj, DELAYC.OBJ LIB CLIPPER, EXTEND
- ;
- ; To link into your Clipper Summer 87 app:
- ; PLINK86 FILE yourapp.obj, DELAYC.OBJ LIB CLIPPER, EXTEND
- ;
- ;**********************************************************************
- .MODEL LARGE
- EXTRN __parni:FAR, __ret:FAR
- PUBLIC delay
- .CODE
-
- Timerlow EQU WORD PTR ds:[06ch]
-
- delay PROC FAR ;entry point
- push ax ;save registers
- push bx ;
- push cx ;
- push dx ;
- push ds ;
- mov ax,1 ;routine to get a numeric
- push ax ;parameter from Clipper,
- call __parni ;converted to an int in
- add sp,2 ;ax
- mov cx,ax ;put it in cx
- jcxz d999 ;skip if cx==0
- mov ax,040h ;
- mov ds,ax ;ds == 040h
- d010: ;
- mov ax,Timerlow ;get timer tick count low
- d020: ;
- cmp ax,Timerlow ;watch for it to change
- je d020 ;keep watching until it does
- loop d010 ;keep looping until cx == 0
- d999: ;
- call __ret ;post NIL return value
-
- pop ds ;restore registers
- pop dx ;
- pop cx ;
- pop bx ;
- pop ax ;
- ret ;return to caller
- delay ENDP
-
- END